﻿#region Header
/*
Behavioral Rating of Dancing Human Crowds based on Motion Patterns
By

Pascal Hauser 
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

and

Raphael Gfeller
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

*/
#endregion

#region Usings

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Emgu.CV;
using Emgu.CV.Structure;

#endregion

namespace paravili.Steps {

	/// <summary>
	/// Description of the class
	/// </summary>
	public class ConvertToGrayImage : ProcessStepWithMeasurement<Image<Bgr, byte>> {

		#region Public Properties

		[ConfigurabelBooleanValue(Name = "is enable, converts a colored image into a grayed image")]
		public bool IsEnable { get; set; }

		#endregion

		#region Public Methods

		public ConvertToGrayImage() {
			IsEnable = false;
		}

		#endregion

		#region Private Methods

		protected override Image<Bgr, byte> OnProcess(Image<Bgr, byte> toProcess) {
			if (IsEnable && toProcess != null) {
				return toProcess.Convert<Gray, byte>().Convert<Bgr, byte>();
			}
			return toProcess;
		}

		#endregion
	}
}
